<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <link rel="stylesheet" href="../../css/style.css">
    <title>退货</title>
    <style>
       .search{display: flex;flex: 1;margin-left: 100px;}
        .search .form-group{margin: 10px 20px;}
        .search .form-group label{padding-right: 10px;}
        .search .searchBtn{height: 27px;margin: 30px;}
         #search form .form-group label{font-weight: normal;}
         #search #searchBtn{margin:20px 30px;}
         ul li{list-style-type: none;}
         .goodsInfo {padding: 0px;}
          .goodsInfo li {display: inline-block;}
         .handleBtn,.eyeBtn{border: none;background-color: #fff;}
         .goodsImg img{width: 70px;height: 70px;}
         .hideBtn{display: none;}
         .handleState,.searchType{height: 27px;margin: 10px;}
         tr td{vertical-align: middle;}
    </style>
</head>
<body>

    <div class="configNav"></div>
    <!-- content -->
    <div class="container-fluid">
        <div class="row">
            <!-- left -->
            <div class="col-md-2">
                <div class="list-group">
                    <a href="ass_refund.html" class="list-group-item">退款记录</a>
                    <a href="ass_returngoods.html" class="list-group-item  active">退货记录</a>
                </div>
            </div>
            <!-- right -->
            <div class="col-md-10">
                <ol class="breadcrumb">
                    <li><a href="">商家管理中心</a></li>
                    <li><a href="">售后服务</a></li>
                    <li class="active"><a href="">退款记录</a></li>
                </ol>

               <div id="search">
                    <form class="form-inline col-md-10" >
                    <div class="form-group">
                            <label for="">申请时间</label>
                            <div class="input-group date form_date_str"  data-date="" data-date-format="dd MM yyyy"  data-link-format="yyyy-mm-dd">
                                    <input  class="sreenMedia" type="text" value="" id="startTime" readonly>
                                    <span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
                            </div>
                            -
                            <div class="input-group date  form_date_end" style="margin-right:10px;" data-date="" data-date-format="dd MM yyyy"  data-link-format="yyyy-mm-dd">
                                    <input  class="sreenMedia" type="text" value="" id="endTime" readonly>
                                    <span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
                            </div>
                            处理状态
                        <select class="handleState">
                        	<option value="" >全部</option>
                            <option value="1">待审核</option>
                            <option value="2">不通过</option>
                            <option value="3">通过</option>
                        </select>
                        <select class="searchType">
                        	<option value="" >全部</option>
                            <option value="orderSn" >订单编号</option>
                            <option value="refundSn" >退款编号</option>
                            <option value="buyerName">买家会员名</option>
                        </select>
                        <input type="text" class="searchNumber">
                    </div>
                </form>
                    <button style="width:70px;" class="searchBtn">搜索</button>
           </div>
            <hr>
            <table class="table table-bordered" >
               <thead>
                   <tr>
                       <td>商品/订单号/退货号</td>
                       <td>退款金额</td>
                       <td>退货数量</td>
                       <td>买家会员名</td>
                       <td>申请时间</td>
                       <td>处理状态</td>
                       <td>平台确认</td>
                       <td>操作</td>
                   </tr>
               </thead>
               <tbody class="mainBox">

               </tbody>
             </table>

            <nav aria-label="...">
                <div class="">
                  <span id="pageNum">共&nbsp;<strong></strong>&nbsp;页&nbsp;/&nbsp;</span><span id="totalNum">&nbsp;<strong>0</strong>&nbsp;条数据</span>
                </div>
                <ul id="example"></ul>
              </nav>
            </div>
        </div>
    </div>
    <script src="../../js/jquery.min.js" charset="utf-8"></script>
    <script src="../../js/bootstrap.min.js" charset="utf-8"></script>
     <script src="../../plugin/layer/layer.js" charset="utf-8"></script>
    <script src="../../plugin/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js" charset="utf-8"></script>
    <script src="../../plugin/bootstrap-datetimepicker/js/bootstrap-datetimepicker.zh-CN.js" charset="utf-8"></script>
    <script src="../../plugin/wangEditor/release/wangEditor.min.js" charset="utf-8"></script>
    <script src="../../js/nav.js" charset="utf-8"></script>
    <script src="../../js/common.js" charset="utf-8"></script>
    <script src="../../js/bootstrap-paginator.js" charset="utf-8"></script>
    <script src="../../js/ajax.js" charset="utf-8"></script>
         <script>
               //时间
        $(".form_date_str").datetimepicker({
    　    minView: "month", 
        　format: "yyyy-mm-dd", 
        　language: 'zh-CN', 
        　autoclose:true 
        });
        $(".form_date_end").datetimepicker({
        　minView: "month", 
        　format: "yyyy-mm-dd", 
        　language: 'zh-CN',
        　autoclose:true 
        });
         $(document).ready(function(){
                tableList()
            });
var pageUrls = cncbk_common_tools.serverURL + '/aftersales/store/queryOrderRefund';
        function tableList(){

            //分页
            data = {
                'type':2,
                'page':page,
                'pageSize':pagesize
            }
            data.page = 1
            ajax(
                pageUrls,
                data,
                pageNumList,
                'post',
                'json'
            )
        }

         //数据渲染
         function  OpendList(res){
             $('.mainBox').empty();
             var html='';
             for (var i = 0; i < res.data.list.length; i++) {
                 var hidePecilBtn='',hideEyeBtn='',auditStatus='';
                 switch(res.data.list[i].auditStatus){
                    case '1':
                    hideEyeBtn='hideBtn';
                    auditStatus="待审核";
                    break;
                    case '2':
                    hidePecilBtn='hideBtn';
                     auditStatus="审核未通过";
                    break;
                    case '3':
                    hidePecilBtn='hideBtn';
                     auditStatus="审核通过";
                    break;
                    case '4':
                    hidePecilBtn='hideBtn';
                     auditStatus="审核通过并弃货";
                    break;
                 }
                html+='<tr>'+
                '<td>'+
                '<ul class="goodsInfo">'+
                '<li class="goodsImg"><img src="http://axyhpic.oss-cn-zhangjiakou.aliyuncs.com/'+ res.data.list[i].goodsImage+'" alt=""></li>'+
                '<li>'+
                '<span><a href="http://47.92.118.122/html/wytx/goods_particulars.html?id='+res.data.list[i].goodsId +'">'+ res.data.list[i].goodsName+'</a></span><br>'+
                '<span>订单编号：'+ res.data.list[i].orderSn+'</span><br>'+
                '<span>退货编号：'+ res.data.list[i].refundSn+'</span>'+
                '</li>'+
                '</ul>'+
                '</td>'+
                '<td>￥<span>'+ res.data.list[i].refundAmount+'</span></td>'+
                '<td><span>'+ res.data.list[i]. goodsQuantity+'</span></td>'+
                '<td><span>'+ res.data.list[i].buyerName+'</span></td>'+
                '<td>'+ res.data.list[i].addTime+'</td>'+
                '<td>'+ auditStatus+'</td>'+
                '<td>'+ res.data.list[i].status+'</td>'+
                '<td>'+
                ' <button class="handleBtn '+ hidePecilBtn+'" id="'+ res.data.list[i].refundId+'" auditStatus="'+  res.data.list[i].auditStatus+'"><span><i class="glyphicon glyphicon-pencil"></i></span><br>处理</button>'+
                '<button class="handleBtn '+ hideEyeBtn +'" id="'+ res.data.list[i].refundId+'"  auditStatus="'+  res.data.list[i].auditStatus+'"><span><i class="glyphicon glyphicon glyphicon-eye-open"></i></span><br>查看</button>'
                '</td>'+
                '</tr>';
         }
         $('.mainBox').append(html);

         //搜索
         $('.searchBtn').click(function(){
                var pageUrls =cncbk_common_tools.serverURL + '/aftersales/store/queryOrderRefund';
                var startTime = $('#startTime').val();//开始时间
                var endTime = $('#endTime').val();//结束时间
                var auditStatus = $('.handleState option:selected').val();//商家审核状态
                var searchNumber=$('.searchNumber').val();//input输入的内容
                var type =$('.searchType option:selected').val();//查询类型
                var searchType='';
                if (type == 'orderSn'){
                	searchType='orderSn';
                }else if (type == 'refundSn'){
                	searchType='refundSn';
                }else if (type == 'buyerName'){
                	searchType='buyerName';
                }
                console.log(searchType)
                data={
                    'startTime':startTime,
                    'endTime':endTime,
                    'auditStatus':auditStatus,
//                  searchType:searchNumber,
                    'page':1,
                    'pageSize':10
                }
                data[searchType]=searchNumber;
                ajax(
                    pageUrls,
                    data,
                    pageNumList,
                    'post',
                    'json'
                )
            })
         	$('input').val('');
         	$('.handleState option:selected').val('');
         	$('.searchType option:selected').val('');
             //处理页面跳转
             $('.handleBtn').click(function(){
                window.location.href = "refundgoods.html?id="+ $(this).attr('id');
            })

        }
         </script>
</body>
</html>
